namespace Jumpton.SFA.Server.Entity {
    using System;
    using System.Collections.Generic;
    using System.Text;
    using Jumpton.Persistent;
    using System.Data;
    using System.Runtime.Serialization;
    
    
    [System.SerializableAttribute()]
    [Map("Objective_Details")]
    public class Objective_Details : ObjectRow {
        
        public Objective_Details() {
        }
        
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="dataRow">DataTable 中的一行数据</param>
        /// <param name="objectTable">存储当前对象的数据表格</param>
        public Objective_Details(System.Data.DataRow dataRow, ObjectTable parent) : 
                base(dataRow, parent) {
        }
        
        /// <summary>
        /// 供反序列化使用的构造函数
        /// </summary>
        /// <param name="info"></param>
        /// <param name="context"></param>
        protected Objective_Details(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context) : 
                base(info, context) {
        }
        
        [Key("ID",true,true)]
        public decimal ID {
            get {
                return (System.Decimal)GetValue("ID");
            }
            set {
                SetValue("ID", value);
            }
        }

        [Field("OBJECTIVE_ID")]
        public int OBJECTIVEID
        {
            get {
                return (System.Int32)GetValue("OBJECTIVEID");
            }
            set {
                SetValue("OBJECTIVEID", value);
            }
        }

        [Field("KEYID")]
        public int KEYID
        {
            get {
                return (System.Int32)GetValue("KEYID");
            }
            set {
                SetValue("KEYID", value);
            }
        }

        [Field("OBJECTID")]
        public string OBJECTID
        {
            get {
                return (System.String)GetValue("OBJECTID");
                
            }
            set {
                SetValue("OBJECTID", value);
            }
        }

        [Field("OBJECTIVE_DATA")]
        public decimal ObjectiveData {
            get {
                return (System.Decimal)GetValue("ObjectiveData");
            }
            set {
                SetValue("ObjectiveData", value);
            }
        }

        [Field("ACTUAL_DATA")]
        public decimal ActualData {
            get {
                return (System.Decimal)GetValue("ActualData");
            }
            set {
                SetValue("ActualData", value);
            }
        }

        [Field("ACTUAL_DATA_TODAY")]
        public decimal ActualDataToday {
            get {
                return (System.Decimal)GetValue("ActualDataToday");
            }
            set {
                SetValue("ActualDataToday", value);
            }
        }
        
       

        [Field("DOMAIN_ID")]
        public decimal DomainID {
            get {
                return (System.Decimal)GetValue("DomainID");
            }
            set {
                SetValue("DomainID", value);
            }
        }

        [Field("LAST_UPDATE_TIME")]
        public decimal LAST_UPDATE_TIME
        {
            get {
                return (System.Decimal)GetValue("LAST_UPDATE_TIME");
            }
            set {
                SetValue("LAST_UPDATE_TIME", value);
            }
        }

        [Field("ACTIVE")]
        public bool Active {
            get {
                return (System.Boolean)GetValue("Active");
            }
            set {
                SetValue("Active", value);
            }
        }

        [Field("YEAR_MONTH")]
        public string YEARMONTH
        {
            get {
                string date = (System.String)GetValue("YEARMONTH");
                if (date != "" && date.Length > 4)
                    date = date.Insert(4, "-");
                return date;
            }
            set {
                SetValue("YEARMONTH", value);
            }
        }
        
       
        [Field("LAST_UPDATER")]
        public string LAST_UPDATER
        {
            get {
                return (System.String)GetValue("LAST_UPDATER");
            }
            set {
                SetValue("LAST_UPDATER", value);
            }
        }

        [Field("CREATE_TIME")]
        public decimal CREATETIME
        {
            get
            {
                return (System.Decimal)GetValue("CREATETIME");
            }
            set
            {
                SetValue("CREATETIME", value);
            }
        }

        [CalculateField]
        public string UNIT
        {
            get
            {
                ObjectRow or = null;
                or = ObjectRow.Load(typeof(Objective), "this.ID=" + OBJECTIVEID);
                if (or != null)
                {
                    return ((Objective)or).Unit;
                }
                return "";
            }

        }
    }
}
